<?
header('Access-Control-Allow-Origin: *');
header('Content-type: application/x-javascript');  // output as JSON
require_once('db/db.php');
$db = new DBConnection('dbname=assclap_realty port=5432 user=assclap_assclap password=fibo1235');
$R = null;
if (isset($_GET['id']))
{
	$id = $_GET['id'];
	
	$sql = "select property.id, address, city, county, state, zip, bed, bath, house_size, lot_size, to_char(price, 'LFM9,999,999') as price, price_per_sq_ft, property_type, subdivision, area, architecture, built_year, property.mls_id, days_on_site, url, description, images, heating, exterior_construction, roofing, int_features, ext_features, property_aux.rating, property_aux.comments
FROM property left join property_aux on (property_aux.mls_id = property.mls_id) WHERE property.id = $id";
	$Query = $db->CreateQuery($sql);
	$R = $Query->FetchObject();
} 
echo json_encode($R);
?>